<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Document</title>
    <link rel="stylesheet" href="../../css/api.css">
    <link rel="stylesheet" href="../../css/news.css">
    <link rel="stylesheet" href="../../css/login.css">
    <style>
        .login-bg {
            padding: 10px 0;
            width: 100vw;
        }
    </style>
</head>

<body>
    <div class="login-bg" id="view" v-cloak>
        <div class="wrap">
            <ul class="input-wrap w-bg">
                <li class="li code">
                    <span class="name">{{_i18n('验证码')}}</span>
                    <input style="width: 150px;" type="text" :placeholder="_i18n('请输入收到的验证码')">
                    <span class="get-code new-theme-color forget" data-status=0 tapmode onclick="getCode()">{{_i18n('发送验证码')}}</span>
                </li>
                <li class="li pwd">
                    <span class="name">{{_i18n('设置密码')}}</span>
                    <input type="password" :placeholder="_i18n('请输入6位数字支付密码')">
                </li>
                <li class="li phone new-hide">
                    <span class="name">+86</span>
                    <input type="text" :placeholder="_i18n('请输入手机号')">
                </li>
                <!-- <li class="li pwd2">
                    <span>确认密码</span>
                    <input type="password" placeholder="请再次输入密码">
                </li> -->
            </ul>
            <button class="new-btn" tapmode onclick="submit()">{{_i18n('立即修改')}}</button>
        </div>
    </div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/jquery.js"></script>
<script src="../../script/ffkj.js"></script>
<script src="../../script/code.js"></script>
<script src="../../script/keyboard.js"></script>
<script src="../../script/vue.js"></script>
<script>
    var view = new Vue({
        el: '#view'})
    apiready = function() {
        var phone = api.pageParam['phone'];
        $('.phone input').val(phone)
    }

    // 下一步
    function submit() {

        var phone = $.trim($('.phone input').val());
        var pwd = $.trim($('.pwd input').val());
        var code = $.trim($('.code input').val());
        if (!checkMobile(phone)) {
            _msg('请输入正确的手机号');
            return;
        }
        if (pwd.length != 6) {
            _msg('密码格式不正确');
            return;
        }

        if (!phone) {
            _msg('手机号未填写');
            return;
        }
        if (!code) {
            _msg('验证码未填写');
            return;
        }
        var status = 0;
        for (var i = 0; i < 6; i++) {
            var s = pwd.charAt(i);
            if (isNaN(s)) {
                status = 1;
            }
        }
        if (status == 1) {
            _msg('密码格式不正确');
            return;
        }
        _ajax('api/user/editInfo', function(ret, err) {
            if (ret && ret.code == 200) {
                _msg('修改密码成功');
                timerWin();
            } else {
                _msg('密码修改失败');
            }
        }, {
            user_id: $api.getStorage('userid'),
            paypwd: pwd,
            code: code
        })
    }
</script>

</html>